import request from '../../../utils/request'

//获得所有数据字典接口
export const ListAllDataDicts = () => {
    return request({
        url: `/dataDict/listAllDataDicts`,
        method: 'get',
    })
}

//插入一个数据字典接口
export const InsertDataDict = (itemName) => {
    return request({
        url: `/dataDict/insertDataDict/${itemName}`,
        method: 'post',
    })
}

//插入一个数据字典的item接口
export const InsertDataDictItem = (itemName, itemValue) => {
    return request({
        url: `/dataDict/insertDataDictItem/${itemName}/${itemValue}`,
        method: 'post',
    })
}

//修改一个数据字典接口
export const EditOneDataDict = (code, itemName) => {
    return request({
        url: `/dataDict/editOneDataDict/${code}/${itemName}`,
        method: 'put',
    })
}

//修改一个数据字典的item接口
export const EditOneDataDictItem = (itemName, oldItemValue, newItemValue) => {
    return request({
        url: `/dataDict/editOneDataDictItem/${itemName}/${oldItemValue}/${newItemValue}`,
        method: 'put',
    })
}

//删除一个数据字典接口
export const DeleteOneDataDict = (code) => {
    return request({
        url: `/dataDict/deleteOneDataDict/${code}`,
        method: 'delete',
    })
}

//删除一个数据字典的item接口
export const DeleteOneDataDictItem = (code, itemValue) => {
    return request({
        url: `/dataDict/deleteOneDataDictItem/${code}/${itemValue}`,
        method: 'delete',
    })
}

//查询一个数据字典接口--条件查询
export const ListAllDataDictsByCondition = (keyWord) => {
    return request({
        url: `/dataDict/listAllDataDicts/${keyWord}`,
        method: 'get',
    })
}